<?php

namespace App\Http\Requests\Backend\Message;

use Illuminate\Foundation\Http\FormRequest;

class MessageTemplateStoreRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'desc'=>'required',
            'title'=>'required',
            'content'=>'required',
            'key_word'=>'required_with:url',
            'url'=>'required_with:key_word',
        ];
    }

    public function messages()
    {
        return [
            'desc.required'=>'消息说明必填',
            'title.required'=>'消息标题必填',
            'content.required'=>'消息内容必填',
            'key_word.required_with'=>'缺少关键词',
            'url.required_with'=>'缺少url',
        ];
    }
}
